package com.idp.web.dao;

import com.idp.common.base.BaseDao;
import com.idp.web.entity.Department;
import com.idp.web.entity.HospitalDepartment;
import com.idp.web.entity.Hospitals;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 医院与科室关系dao接口
 *
 * @author xubinren
 * @version 1.0
 * @date 2018/2/28
 */
public interface HospitalDepartmentDao extends BaseDao<HospitalDepartment, String> {


    /**
     * 根据医院主键获取对应的医院下科室ids
     *
     * @param hospitalId 医院id
     */
    List<String> selectDepartmentIds(@Param(value = "hospitalId") String hospitalId);

    /**
     * 查询医院下是否已经存在当前科室
     *
     * @param hospitalId 医院id
     * @param departmentId 科室id
     * @return HospitalDepartment
     */
    HospitalDepartment checkExist(@Param(value = "hospitalId") String hospitalId,@Param(value = "departmentId") String departmentId);

    /**
     * 根据科室id后去对应的医院信息
     *
     * @param departmentId 科室id
     * @return HospitalDepartment
     */
    Hospitals selectHospital(@Param(value = "hospitalId") String hospitalId,@Param(value = "departmentId") String departmentId);

    /**
     * 根据科室id后去对应的医院信息
     *
     * @param departmentId 科室id
     * @return HospitalDepartment
     */
    Hospitals selectHospitalByDepartmentId(@Param(value = "departmentId") String departmentId);

    /**
     * 根据医院id和科室id删除对应的医院科室信息表信息
     *
     * @param hospitalId 医院id
     * @param departmentId 科室id
     * @return HospitalDepartment
     */
    void deleteBy(@Param(value = "hospitalId") String hospitalId,@Param(value = "departmentId") String departmentId);

    /**
     * 根据医院id删除对应的医院科室信息表信息
     *
     * @param hospitalId 医院id
     * @return HospitalDepartment
     */
    Integer deleteByHospital(@Param(value = "hospitalId") String hospitalId);

    /**
     * 根据医院id和科室id获取对应的医院科室信息表信息
     *
     * @param hospitalId 医院id
     * @param departmentId 科室id
     * @return HospitalDepartment
     */
    HospitalDepartment getHospitalDepartment(
            @Param(value = "hospitalId") String hospitalId,
            @Param(value = "departmentId") String departmentId
    );
}